/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JDialogFamily.java
 *
 * Created on 29/07/2010, 19:50:03
 */
package systole.view.crud.family;

import org.jdesktop.application.Action;

/**
 *
 * @author jmj
 */
public class JDialogFamily extends javax.swing.JDialog {

    /**
     *
     */
    private static final long serialVersionUID = -9113293571696130565L;
    private ControllerFamilyEdition controllerFamilyEdition;

    /** Creates new form JDialogFamily 
     * @param parent 
     * @param controllerFamilyEdition */
    public JDialogFamily(java.awt.Frame parent, ControllerFamilyEdition controllerFamilyEdition) {
        super(parent, true);
        initComponents();
        this.controllerFamilyEdition = controllerFamilyEdition;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPnlBottom = new javax.swing.JPanel();
        jBtnOk = new javax.swing.JButton();
        jBtnCancel = new javax.swing.JButton();
        jPnlCenter = new javax.swing.JPanel();
        jLblDescription = new javax.swing.JLabel();
        jEdtDescription = new javax.swing.JTextField();
        jLblSex = new javax.swing.JLabel();
        jCbmSex = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setModal(true);
        setName("Form"); // NOI18N
        setResizable(false);

        jPnlBottom.setName("jPnlBottom"); // NOI18N
        jPnlBottom.setPreferredSize(new java.awt.Dimension(174, 40));

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getActionMap(JDialogFamily.class, this);
        jBtnOk.setAction(actionMap.get("confirm")); // NOI18N
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getResourceMap(JDialogFamily.class);
        jBtnOk.setText(resourceMap.getString("jBtnOk.text")); // NOI18N
        jBtnOk.setToolTipText(resourceMap.getString("jBtnOk.toolTipText")); // NOI18N
        jBtnOk.setName("jBtnOk"); // NOI18N
        jPnlBottom.add(jBtnOk);

        jBtnCancel.setAction(actionMap.get("cancel")); // NOI18N
        jBtnCancel.setText(resourceMap.getString("jBtnCancel.text")); // NOI18N
        jBtnCancel.setToolTipText(resourceMap.getString("jBtnCancel.toolTipText")); // NOI18N
        jBtnCancel.setName("jBtnCancel"); // NOI18N
        jPnlBottom.add(jBtnCancel);

        getContentPane().add(jPnlBottom, java.awt.BorderLayout.SOUTH);

        jPnlCenter.setName("jPnlCenter"); // NOI18N

        jLblDescription.setFont(jLblDescription.getFont().deriveFont(jLblDescription.getFont().getStyle() | java.awt.Font.BOLD));
        jLblDescription.setText(resourceMap.getString("jLblDescription.text")); // NOI18N
        jLblDescription.setName("jLblDescription"); // NOI18N

        jEdtDescription.setText(resourceMap.getString("jEdtDescription.text")); // NOI18N
        jEdtDescription.setToolTipText(resourceMap.getString("jEdtDescription.toolTipText")); // NOI18N
        jEdtDescription.setName("jEdtDescription"); // NOI18N

        jLblSex.setFont(jLblSex.getFont().deriveFont(jLblSex.getFont().getStyle() | java.awt.Font.BOLD));
        jLblSex.setText(resourceMap.getString("jLblSex.text")); // NOI18N
        jLblSex.setName("jLblSex"); // NOI18N

        jCbmSex.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "F", "M" }));
        jCbmSex.setToolTipText(resourceMap.getString("jCbmSex.toolTipText")); // NOI18N
        jCbmSex.setName("jCbmSex"); // NOI18N

        javax.swing.GroupLayout jPnlCenterLayout = new javax.swing.GroupLayout(jPnlCenter);
        jPnlCenter.setLayout(jPnlCenterLayout);
        jPnlCenterLayout.setHorizontalGroup(
            jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlCenterLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLblDescription, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLblSex, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(18, 18, 18)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jEdtDescription, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE)
                    .addComponent(jCbmSex, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPnlCenterLayout.setVerticalGroup(
            jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlCenterLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jEdtDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLblDescription))
                .addGap(11, 11, 11)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jCbmSex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLblSex))
                .addContainerGap())
        );

        getContentPane().add(jPnlCenter, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBtnCancel;
    private javax.swing.JButton jBtnOk;
    private javax.swing.JComboBox jCbmSex;
    private javax.swing.JTextField jEdtDescription;
    private javax.swing.JLabel jLblDescription;
    private javax.swing.JLabel jLblSex;
    private javax.swing.JPanel jPnlBottom;
    private javax.swing.JPanel jPnlCenter;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the jCbmSex
     */
    public javax.swing.JComboBox getjCbmSex() {
        return jCbmSex;
    }

    /**
     * @return the jEdtDescription
     */
    public javax.swing.JTextField getjEdtDescription() {
        return jEdtDescription;
    }

    /**
     * 
     */
    @Action
    public void confirm() {
        this.controllerFamilyEdition.ok();
    }

    /**
     * 
     */
    @Action
    public void cancel() {
        this.controllerFamilyEdition.cancel();
    }
}
